package com.sskjdata.cg.jwt;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;

import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Descirption  jwtuser创建工厂
 */
public final class JwtUserFactory {

    private JwtUserFactory() {
    }

    public static JwtUser create(String id, String username, String password, Date lastPasswordResetDate) {
        final  JwtUser jwtUser = new JwtUser(id, username, password, lastPasswordResetDate);
        return jwtUser;
    }

    private static List<GrantedAuthority> mapToGrantedAuthorities(List<String> authorities) {
        return authorities.stream()
                .map(SimpleGrantedAuthority::new)
                .collect(Collectors.toList());
    }
}

